package com.example.fitnessservice.service.impl;

import com.example.fitnessservice.module.dao.placemapper.PlaceMapper;
import com.example.fitnessservice.module.pojo.CourseDetails;
import com.example.fitnessservice.module.pojo.CourseDetailsCamp;
import com.example.fitnessservice.service.PlaceService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Service
public class PlaceServiceImpl implements PlaceService {
    @Resource
    private PlaceMapper placeMapper;

    /**
     * 修改场地的开始和结束时间
     *
     * @param placeId
     * @param startTime
     * @param endTime
     * @return
     */
    @Override
    public boolean updatePlaceTime(Integer placeId, Date startTime, Date endTime) {
        int count = placeMapper.updatePlaceTime(placeId, startTime, endTime);
        return count == 1 ? true : false;
    }

    /**
     * 查询该场馆下的所有课程
     * @param placeId
     * @return
     */
    @Override
    public List<CourseDetails> findCourseInPlace(Integer placeId) {
        return placeMapper.findCourseInPlace(placeId);
    }

    @Override
    public List<CourseDetailsCamp> findCampInPlace(Integer placeId) {
        return placeMapper.findCampInPlace(placeId);
    }


}
